import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1

Button {
    width: parent.width * 0.07
    height: parent.height //- parent.spacing
    checkable: true

    property string textColor;
    property string color
    property string pressedColor

    property var data

    signal buttonSelected(var button)
    onCheckedChanged: {
        if (checked) {
            buttonSelected(this);
        }
    }

    style: ButtonStyle {
        label: Text {
            antialiasing: true
            renderType: Text.NativeRendering
            verticalAlignment: Text.AlignVCenter
            horizontalAlignment: Text.AlignHCenter
            text: control.text
            font.bold: true
            font.pixelSize: 20
            color: control.checked ? "white" : textColor
            wrapMode: Text.Wrap
            elide: Text.ElideRight
            maximumLineCount: 5
        }
        background: Rectangle {
            antialiasing: true
            implicitWidth: 100
            implicitHeight: 25
            border.width: control.activeFocus ? 2 : 1
            border.color: control.checked ? control.pressedColor : "#888"
            radius: 8
            color: control.checked ? control.pressedColor : control.color
        }
    }
}
